﻿@using SJNScaffolding.WPF.Extend
@model SJNScaffolding.Models.TemplateModels.ViewFileModel
var editUI = {
    initCombobox: function (pDialog) {
        var comboboxControl = @RazorHelper.RawHtml(Model.ComboboxPart);
        $.each(comboboxControl, function (i, v) {
            pDialog.find('#' + v.ColumnName)[v.ClassName]({
                url: com.baseUrl + '/baseItem/GetComBoJson?enCode=' + v.ColumnName
            });
        });
    },
    initUpload: function (pDialog,uploadControl) {
        $.each(uploadControl,function(i,v){
            pDialog.find('#'+v.WebuploadId).powerWebUpload({
                auto: true,
                uploadType: v.UploadType
            });
        })
    },
    setForm: function (id,pDialog,ignore) {
        editUI.initCombobox(pDialog);
        var uploadControl=@RazorHelper.RawHtml(Model.WebUploadPart);
        if(ignore!=true){
          editUI.initUpload(pDialog,uploadControl);
        }
        com.setForm(id, function (jsonData) {
            //com.loadCityPicker($("#Province"), jsonData.Province, jsonData.City, jsonData.Area);
            $.each(uploadControl,function(i,v){
                webuploader.loadFile({
                    elem: v.WebuploadId,
                    rows: jsonData[v.WebuploadId+'Outputs'],
                    uploadType: v.UploadType,
                    isCheck: ignore
                });
            })
        },true,'/Plat/@(Model.TableName)/GetInfoForEdit',pDialog);
    }
}